<?php

require_once './includes/modelo.class.php';



function analysisIsDone($id_anal) {
	$model = model::getInstance();
	
	$result = $model->analysisIsDone($id_anal);
	return new soapval ( 'return', 'xsd:boolean', $result );
}


function auth($mac,$mail) {
	$model = model::getInstance();
	
	$result = $model->checkIn($mac,$mail);
	return new soapval ( 'return', 'xsd:boolean', $result );
}

function imWorkingIn($mac,$id_anal) {
	$model = model::getInstance();
	
	$result = $model->areRelated($mac, $id_anal);
	return new soapval ( 'return', 'xsd:boolean', $result );
}
function requestIdAnalysis($mac) {
	$model = model::getInstance();
	
	$result = $model->requestIdAnalysis($mac);
	return new soapval ( 'return', 'xsd:int', $result );
}

function getPreRequisites($mac){
	//TODO buscar o SO de acordo com o MAC
	$result[0] = array("appname"=>"blast","md5"=>"5c4d16e5ae0047043d5cc1ff4edf02b6","url"=>"http://panic.c3p0ger.ufsc.br:8888/files/blast.linux.bin");
	$result[1] = array("appname"=>"formatdb","md5"=>"5c4d16e5ae0047043d5cc1ff4edf02b6","url"=>"http://panic.c3p0ger.ufsc.br:8888/files/formatdb.linux.bin");
	return new soapval ( 'return', 'tns:arrayDownload', $result );
}

function getSeqs($mac, $id_anal,$num){
	$model = model::getInstance();
	//TODO Fazer Teste
	$result = $model->getSeqs($mac, $id_anal, $num);
	
	return new soapval ( 'return', 'xsd:boolean', $result );
}
/*
function arrayTest(){
	$result['job_id'] = 5;
	$result['seq_db'] = array('dfgh','reyt');
	$result['seq_in'] = array('dfgh','reyt');
	return new soapval ( 'return', 'tns:job', $result );
}
*/


function setResults($job_id,$result){
	$model = model::getInstance();
	
	$result = $model->setResults($job_id,$result);
	
	return new soapval ( 'return', 'xsd:boolean', $result );
}


?>